<!--
 * @Descripttion: 正则表达式范围
 * @Author: YuZhenJing
 * @Date: 2020-07-01 20:28:30
 * @LastEditors: YuZhenJing
 * @LastEditTime: 2020-07-01 20:57:04
-->
<!DOCTYPE html>
<html lang="zh_CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>正则表达式范围</title>
  </head>
  <body>
    <script>
      let title_style = "font-weight: bold;color:red;";
      let test_style = "padding-left:20px;color:yellow;";
      console.log("%c范围介绍：", title_style);
      console.log(
        "%c原子表，多选一，括号中的任意单个元素:",
        test_style,
        "anyun666".match(/[a-z]+/)
      );
      console.log(
        "%c原子组，组里内容看做为一个元素:",
        test_style,
        "anyun666".match(/^([a-z]+)(\d+)$/)
      );
      console.log(
        "%c原子组，别名:",
        test_style,
        "anyun666".match(/^(?<letter>[a-z]+)(?<number>\d+)$/)["groups"]
      );
      console.log(
        "%c原子组，不记录组:",
        test_style,
        "anyun666".match(/^([a-z]+)(?:\d+)$/)
      );
      console.log("%c|或:", test_style, "anyun666.com.cn".match(/(com|cn)+/g));
      console.log("%c[^...] 取反", test_style, "anyun666".match(/[^a-z]+/));
    </script>
  </body>
</html>
